var Page = function(){
    this.init();
};
Page.prototype = {
    params: {
        passport: '',
        messageId:''
    },
    init: function(){
        this.initParams();
        this.initEvent();
    },
    initParams: function(){
        this.params.passport = Pub.getCookie('_PASSPORT');
        this.params.messageId = Pub.getSession('messageId');
    },
    getData: function(){
        var _this = this;
        var paramsObj = {
            passport: _this.params.passport,
            messageId: _this.params.messageId,
            userId:Pub.getSession('userId')
        };
        Api.getusermessageinfo(paramsObj, function(data){
            console.log(data);
            $('#title').text(data.title);
            $('#pushTime').text(data.gmtCreate);
            $('#desc').text(data.desc);
            var json=JSON.parse(data.params);
            console.log(json);

            if (json.type==1 || json.type==3 || json.type==4) {
                $('#pushType').text('文字');
                ue.ready(function() {//编辑器初始化完成再赋值
                  ue.setContent(json.content);  //赋值给UEditor
                });
            }else{
                $('#pushType').text('链接');
                $('.editorWrap').css('display', 'none');
                $('.h5Wrap').show();
                $('#h5text').text(json.content);
            };

        });
    },
    otherEvent:function(){
        var _this = this;
        $('.goods-checkbox input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        })
    },
    initEvent: function(){
        var _this = this;
         _this.getData();
        _this.otherEvent();


    }
};
var page = new Page();